/**
 * 项目名：	Rumba Plan
 * 
 * 版权所有(C)，上海海鼎信息工程股份有限公司，2006，所有权利保留。
 * 
 * 文件名：	ViewCartridgeAdvSys.java
 * 模块说明：	
 * 修改历史：
 * 2006-6-29 - lxm - 创建。
 */
package com.hd123.rumba.action.cartridge;

import net.sf.hibernate.HibernateException;

import com.hd123.rumba.cartridge.FVRumbaAdvSys;
import com.hd123.rumba.exception.BusinessException;
import com.hd123.rumba.request.Action;
import com.hd123.rumba.request.ActionConstants;

/**
 * 构件包 | Action | FVRumbaAdvSys
 * 
 * @author lxm
 * 
 */
public class ViewCartridgeAdvSys extends BaseViewCartridge implements Action {

  public static final String CAPTION_VIEW = "构架包维护(高级)";

  /* 权限常量 */
  public static final String FUNCV_PREFIX = FVRumbaAdvSys.FUNCV_PREFIX;
  public static final String PERMISSION_CARTRIDGE_VIEW = FUNCV_PREFIX + ".构件包.查看权";
  public static final String PERMISSION_FUNCVIEW_VIEW = FUNCV_PREFIX + ".功能视图.查看权";

  public String execute() throws Exception {
    String url = ActionConstants.NOTIMPLEMENTED;
    dd.put("viewName", "ViewCartridgeAdvSys");

    String startnode = (String) dd.getFormValue("start");
    if (startnode == null)
      startnode = "list";
    if ("list".equals(startnode))
      url = this.executeWithPermission("list", PERMISSION_CARTRIDGE_VIEW);
    if ("view".equals(startnode))
      url = this.executeWithPermission("view", PERMISSION_CARTRIDGE_VIEW);
    if ("viewFuncView".equals(startnode))
      url = this.executeWithPermission("viewFuncView", PERMISSION_FUNCVIEW_VIEW);

    return url;
  }

  @Override
  public String getPermission(String functionName) throws BusinessException, HibernateException {
    if (ViewCartridge.FUNCTION_CARTRIDGE_VIEW.equals(functionName))
      return PERMISSION_CARTRIDGE_VIEW;
    if (ViewCartridge.FUNCTION_FUNCVIEW_VIEW.equals(functionName))
      return PERMISSION_FUNCVIEW_VIEW;
    return null;
  }

  @Override
  protected void putFormPermissions() throws BusinessException {
    dd.put("permissionCartridgeView", PERMISSION_CARTRIDGE_VIEW);
    dd.put("permissionFuncViewView", PERMISSION_FUNCVIEW_VIEW);
  }

}
